CLS
OPEN "outlet.in" FOR INPUT AS #1
OPEN "outlet.out" FOR OUTPUT AS #2

INPUT #1, n
FOR i = 1 TO n
  INPUT #1, k
  sum = 0
  FOR j = 1 TO k
    INPUT #1, t
    sum = sum + t
  NEXT j

  ans = sum - k + 1

  PRINT #2, LTRIM$(STR$(ans))
NEXT i

CLOSE #1, #2
END

